<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>微信支付</title>

<%
    String basePath = request.getContextPath();
	String appId = request.getParameter("appId");
	String timeStamp = request.getParameter("timeStamp");
	String nonceStr = request.getParameter("nonceStr");
	String packageInfo = request.getParameter("packageInfo");
	String signInfo = request.getParameter("signInfo");
%>
<script src="<%=basePath%>/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
</head>

<body>
</body>
<script type="text/javascript">

$(function(){ 
	if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', callpay, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', callpay);
            document.attachEvent('onWeixinJSBridgeReady', callpay);
        }
    } else {
    	callpay();
    }
}); 
  	function callpay(){
		 WeixinJSBridge.invoke('getBrandWCPayRequest',{
  		 "appId" : "<%=appId %>","timeStamp" : "<%=timeStamp%>", "nonceStr" : "<%=nonceStr%>", "package" : "<%=packageInfo%>","signType" : "MD5",
"paySign" : "<%=signInfo%>" 
   			},function(res){
				WeixinJSBridge.log(res.err_msg);
 				//alert(res.err_code + res.err_desc + res.err_msg);
	            if(res.err_msg == "get_brand_wcpay_request:ok"){  
	            	WeixinJSBridge.invoke('closeWindow',{},function(res){
	            	});
	            }else if(res.err_msg == "get_brand_wcpay_request:cancel"){  
	            	WeixinJSBridge.invoke('closeWindow',{},function(res){
	            	});
	            }else{  
	            	WeixinJSBridge.invoke('closeWindow',{},function(res){
	            	});
	            }  
			})
		}
  	
  </script>
</html>